home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 7
/
007.d81
/
pps #14
< prev
next >
Wrap
Text File
|
2022-08-26
|
2KB
|
110 lines
PEEKs, POKEs, and SYSes -- Part 14
by Jimmy Weiler
======================================
Location:212 Hexadecimal: $00d4
Official Label: QTSW Type: RAM
Useful BASIC commands: PEEK, POKE
======================================
QTSW is the 'quote switch'.
You are probably very familiar with
quote mode. You will type a quote and
suddenly all the cursor/color/ctrl
keys print as characters instead of
performing their functions. That is
what allows you to use those keys in
print statements.
Unfortunately, except while you are
writing a program, there is virtually
NO instance when you want to be in
quote mode. That's where QTSW comes
in.
WHAT QTSW DOES:
Every time the C-64 prints a quote
[CHR$(34)] on the screen, QTSW
toggles. That means the value in
memory location 212 changes from 0 to
1 or from 1 to 0. If PEEK(212)=1 then
you are 'in quote mode' and nothing
will get you out of it except another
quote or a <SHIFT-RETURN>. Printing
a carriage return will turn quote mode
off.
SO WHAT GOOD IS THIS?
Let's write a tiny, worthless word
processor and see.
10 GET K$: IF K$ = "" THEN 10
20 PRINT K$;
30 GOTO 10
This little program seems to work fine
(type something and see) until you
type a quote. Suddenly the arrow
keys and clr/home and inst/del start
printing in reverse instead of
performing their functions.
Now, let's clear the quote switch
after every key press.
20 PRINT K$;: POKE 212,0
Now whatever key you type will perform
its normal function.
Even if you don't write word
processors, you can use QTSW to make
your programs more user-proof. If
you do GETs and carelessly let the
user put a quote on the screen your
program may seem to go completely
haywire. POKE 212,0 after printing
the character that was 'GETted' will
prevent such quote related blow-ups.
--------------------------------------